//
// Created by LiuDongPeng on 2024/1/29.
//

#ifndef FOC_MT6701_H
#define FOC_MT6701_H


#include "EncoderBase.h"
#include "Stm32Base.h"



class MT6701 : public EncoderBase
{
public:
    MT6701(spi_send_recv_t spi_send_recv_cb, stm32_write_pin_t spi_set_cs_cb, bool cs_valid_level);
    ~MT6701() = delete;

    std::tuple<bool, uint32_t, float> update() override;

private:
    bool m_cs_valid_level = false;
    spi_send_recv_t m_spi_send_recv_cb = nullptr;
    stm32_write_pin_t m_spi_set_cs_cb = nullptr;

private:
    bool dir = true;
    uint32_t m_encoderCpr = 16384;
    uint32_t m_encoderRaw = 0;
    float m_angleRad = 0;
};


#endif //FOC_MT6701_H
